const char* get_cache_icon(const Waypoint* waypointp);
const char* gs_get_cachetype(geocache_type t);
const char* gs_get_container(geocache_container t);
-char* xml_entitize(const char* str);
-char* html_entitize(const QString& str);
+QString xml_entitize(const QString& str);
+QString html_entitize(const QString& str);
char* strip_html(const utf_string*);
char* strip_nastyhtml(const QString& in);
char* convert_human_date_format(const char* human_datef); /* "MM,YYYY,DD" -> "%m,%Y,%d" */
gbfprintf(file_out, "<br>\n");
if (wpt->description != wpt->shortname) {
if (wpt->HasUrlLink()) {
- char* d = html_entitize(wpt->description);
- UrlLink link = wpt->GetUrlLink();
- gbfprintf(file_out, "<a href=\"%s\">%s</a>", CSTR(link.url_), d);
- xfree(d);
+ gbfputs(QStringLiteral("<a href=\"%1\">%2</a>")
+ .arg(wpt->GetUrlLink().url_, html_entitize(wpt->description)),
+ file_out);
} else {
gbfprintf(file_out, "%s", CSTR(wpt->description));
}
logpart = xml_findfirst(curlog, "groundspeak:finder");
if (logpart) {
- char* f = html_entitize(logpart->cdata);
- gbfprintf(file_out, "<span class=\"gpsbabellogfinder\">%s</span> on ", f);
- xfree(f);
+ gbfputs(QStringLiteral("<span class=\"gpsbabellogfinder\">%1</span> on ")
+ .arg(html_entitize(logpart->cdata)),
+ file_out);
}
logpart = xml_findfirst(curlog, "groundspeak:date");
s = logpart->cdata;
}
- char* t = html_entitize(s);
- gbfputs(t, file_out);
- xfree(t);
+ gbfputs(html_entitize(s), file_out);
}
gbfprintf(file_out, "</p>\n");
void
HtmlFormat::html_index(const Waypoint* wpt) const
{
- char* sn = html_entitize(wpt->shortname);
- char* d = html_entitize(wpt->description);
-
- gbfprintf(file_out, "<a href=\"#%s\">%s - %s</a><br>\n", sn, sn, d);
-
- xfree(sn);
- xfree(d);
+ gbfputs(QStringLiteral("<a href=\"#%1\">%1 - %2</a><br>\n")
+ .arg(html_entitize(wpt->shortname), html_entitize(wpt->description)),
+ file_out);
}
void
s = logpart->cdata;
}
- r = r + "<br />";
- char* t = html_entitize(s);
- r = r + t;
- xfree(t);
+ r += "<br />";
+ r += html_entitize(s);
}
r += "</p>";
nullptr
};
- /* based on <http://wiki.openstreetmap.org/index.php/Map_Features> */
+/* based on <http://wiki.openstreetmap.org/index.php/Map_Features> */
const OsmFormat::osm_icon_mapping_t OsmFormat::osm_icon_mappings[] = {
OsmFormat::osm_write_tag(const QString& key, const QString& value) const
{
if (!value.isEmpty()) {
- char* str = xml_entitize(CSTR(value));
- gbfprintf(fout, " <tag k='%s' v='%s'/>\n", CSTR(key), str);
- xfree(str);
+ gbfputs(QStringLiteral(" <tag k='%1' v='%2'/>\n")
+ .arg(key, xml_entitize(value)),
+ fout);
}
}
};
static
-char*
+QString
entitize(const char* str, bool is_html)
{
char* p;
}
}
- return (tmp);
+ QString rv(tmp);
+ xfree(tmp);
+ return rv;
}
/*
* Public callers for the above to hide the absence of &apos from HTML
*/
-char* xml_entitize(const char* str)
+QString xml_entitize(const QString& str)
{
- return entitize(str, false);
+ return entitize(CSTR(str), false);
}
-char* html_entitize(const QString& str)
+QString html_entitize(const QString& str)
{
return entitize(CSTR(str), true);
}